package com.atguigu.gmall.product.controller;

import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.model.product.BaseSaleAttr;
import com.atguigu.gmall.model.product.SpuInfo;
import com.atguigu.gmall.product.service.api.ManagerService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author: 封捷
 * @create-date: 2022/8/22 15:35
 */
@Api(tags = "商品信息接口")
@RestController
@RequestMapping("/admin/product")
public class SpuManagerController {

    @Autowired
    private ManagerService managerService;

    @GetMapping("/baseSaleAttrList")
    public Result<List<BaseSaleAttr>> getBaseSaleAttrList() {

        List<BaseSaleAttr> baseSaleAttrList = managerService.getBaseSaleAttrList();

        return Result.ok(baseSaleAttrList);
    }

    @PostMapping("/saveSpuInfo")
    public Result<Void> saveSpuInfo(@RequestBody SpuInfo spuInfo) {

        managerService.saveSpuInfo(spuInfo);

        return Result.ok();
    }

}
